#ifndef FFMPEG_MIXING_SHEAR_H
#define FFMPEG_MIXING_SHEAR_H

#include <QObject>
#include<qprocess.h>
#include<QFileDialog>
#include<qfileinfo.h>
extern "C" {
    #include <libavcodec/avcodec.h>
    #include <libavformat/avformat.h>
    #include <libswscale/swscale.h>
    #include <libavdevice/avdevice.h>
    #include <libavformat/version.h>
    #include <libavutil/time.h>
    #include <libavutil/mathematics.h>

}
#include<qbytearray.h>
#include<QTime>
#include<qbytearray.h>
#include<qthread.h>

class ffmpeg_mixing_shear : public QObject
{
    Q_OBJECT
public:
    explicit ffmpeg_mixing_shear(QObject *parent = nullptr);
    //bug
    /*ffmpeg 的./ 与qt的./ 不同,当传入给ffmpeg 命令 ./目录/out.mp4时,ffmpeg会重新创建幕录,导致ffmpeg找不到文件
     * 所以保存录经不要为相对路径
     */

    //视频静音
    QStringList Video_mute(QStringList filelist,QString outpath);
    double getvideo_timelen(QString videoname);//获得视频时长
    //画面裁剪
    QStringList video_picture_cut(QStringList filelist,int w,int h,int px,int py,QString outpath);
    //分割视频
    QStringList video_cut(QStringList filelist,QTime Each_period_of_time,QString outpath);
    QStringList cut(QString filename,QTime sumtime,QTime eachtime,QString outfilename);
    //视频从重新编码.ts
    QStringList video_coding_ts(QStringList filelist,int bt,int w,int h,QString outpath);
    QStringList video_coding_mp4(QStringList filelist,int bt,int w,int h,QString outpath);
    //合并为一个视频
    QString video_merge(QStringList filelist,QString outpath);

    //保证视频质量,此后
//    argu.append("-c:v");argu.append("copy");
//    argu.append("-c:a");argu.append("copy");

    //视频裁剪开头结尾
    QStringList video_tailor(QStringList videofile,int time_befor,int time_end,QString outpath);//开头结尾减去多少秒
    //水印
    QString addsuiyin(QString video,QString suiyin,int fontsize,int px,int py, QString outpath);
    //添加音频
    QString addaudio( QString video, QStringList audio, QString outpath );
    QString cutaudio(QString video,QString yinpin_filename);//切割音频
    QString hebinvid_aud(QString video,QString yinping,QString outfilename);//合并音视频
    //添加字幕
    QString addzimufile( QString videofile,QString zimufile, QString outpath);
    //分割成想要的长度
    void video_cut_new(QString videofile,QTime whiletime,QString outfilename);
    //删除
    bool DeleteFileOrFolder(QString file);
    bool DeleteFileOrFolder_mute();
    bool DeleteFileOrFolder_cut();
    bool DeleteFileOrFolder_merge();
    bool DeleteFileOrFolder_coding_mp4();
    bool DeleteFileOrFolder_coding_ts();
    bool DeleteFileOrFolder_piccut();
    bool DeleteFileOrFolder_addaudio();
    bool DeleteFileOrFolder_addzimu();
    bool DeleteFileOrFolder_suiyin();
    bool DeleteFileOrFolder_tailor();
private slots:
    void on_readerror();
    void on_readoutput();

signals:
    void signal_ffmover();
    void signal_infoout(QString str,QString process);
private:
    QProcess process;

    QString path_mute,path_cut,path_coding_mp4,path_coding_ts,path_piccut,path_merge,path_addaud,path_addzimu,file_addsuiyin,file_tailor;//删除用

};

#endif // FFMPEG_MIXING_SHEAR_H
